We have made significant progress in several areas related to protein dynamics, folding, binding, and function. Protein folding: We have studied the folding dynamics of small single-domain proteins using coarse-grained simulation models (Best, Hummer, Proc. Natl. Acad. Sci. USA, 2010). The dynamics of protein folding could be represented accurately by diffusion on a low-dimensional free energy surface. However, it proved essential to consider explicitly the dependence of the effective diffusion coefficient D on the position along the folding coordinate. In our study, we explored the position dependence of D, its connection to protein internal friction, and the consequences for the interpretation of single-molecule experiments. We found a large decrease in D when going from unfolded to folded states for folding reaction coordinates that directly measure fluctuations in Cartesian configuration space, including those probed in single molecule experiments. In contrast, we found D to be almost independent of Q, the fraction of native amino-acid contacts. By a simple transformation, we were able to obtain reaction coordinates with position-invariant D. This analysis demonstrates that the folding rate can be estimated accurately from the reconfiguration time in the unfolded state, and thus provides theoretical support for previous estimates of the speed limit for protein folding from single-molecule experiments. Simulation methodology: Molecular-dynamics (MD) simulations are widely used to study the structure and dynamics of bio-macromolecules. But despite their widespread use, MD simulations continue to suffer from poor sampling efficiency. One of the most widely used methods to speed up the sampling is replica exchange molecular dynamics (REMD). We could derive simple analytical expressions for the error and computational efficiency of REMD (Rosta, Hummer, J. Chem. Phys. 2009), and also for another widely used method, simulated tempering (Rosta, Hummer, J. Chem. Phys. 2010). The theory applies to the important case of protein folding, and more generally to systems whose dynamics at long times is dominated by the slow interconversion between two metastable states. Our main result is that, for given computational resources, the relative efficiency of REMD and regular molecular dynamics (MD) simulations is given by the ratio of the number of transitions between the two states averaged over all replicas at the different temperatures, and the number of transitions at the single temperature of the MD run. This formula applies if replica exchange is frequent, as compared to the transition times. With the help of our analytic efficiency formulas, we could specify criteria for the optimal use of computational resources in REMD sampling of protein dynamics and folding.